import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SalesDataVO, SalesDataForm, SalesDataQuery } from '@/api/company/salesData/types';

/**
 * 查询销售数据信息列表
 * @param query
 * @returns {*}
 */

export const listSalesData = (query?: SalesDataQuery): AxiosPromise<SalesDataVO[]> => {
  return request({
    url: '/business/salesData/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询销售数据信息详细
 * @param salesId
 */
export const getSalesData = (salesId: string | number): AxiosPromise<SalesDataVO> => {
  return request({
    url: '/business/salesData/' + salesId,
    method: 'get'
  });
};

/**
 * 新增销售数据信息
 * @param data
 */
export const addSalesData = (data: SalesDataForm) => {
  return request({
    url: '/business/salesData',
    method: 'post',
    data: data
  });
};

/**
 * 修改销售数据信息
 * @param data
 */
export const updateSalesData = (data: SalesDataForm) => {
  return request({
    url: '/business/salesData',
    method: 'put',
    data: data
  });
};

/**
 * 删除销售数据信息
 * @param salesId
 */
export const delSalesData = (salesId: string | number | Array<string | number>) => {
  return request({
    url: '/business/salesData/' + salesId,
    method: 'delete'
  });
};

export const getStoreListAll = () => {
  return request({
    url: '/system/store/listAll',
    method: 'get'
  });
};
